#!/bin/bash

# -- Delete Lines --
# sed command 'd' indicates 'delete lines', 'd' command only delete from output stream.

# - delete everyting
sed 'd' ./test_employee.txt
echo -e '\n'

# - delete specific line 
sed '2 d' ./test_employee.txt # only delete 2rd line
echo -e '\n'

# - delete lines in range 
sed '1,3 d' ./test_employee.txt # delete 1~3 line
echo -e '\n'

# - delete lines from n to end of file 
sed '3,$ d' ./test_employee.txt # delete 3~end of file 
echo -e '\n'

# - delete lines starts with 1 and repeat every 2 lines
sed '1~2 d' ./test_employee.txt # delete only odd lines 
echo -e '\n'

# - delete matching lines 
sed '/Manager/ d' ./test_employee.txt
echo -e '\n'

# - delete all empty lines from a file 
sed '/^$/ d' ./test_employee.txt
echo -e '\n'

# - delete all comments lines 
sed '/^#/ d' ./test_employee.txt # delete all lines start with #
 
